﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WCF_ListenMusic.Services.Module_Member.User
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "LoginService" in code, svc and config file together.
    public class UserSerice : IUserService
    {

        Context.Connect_DBDataContext context = new Context.Connect_DBDataContext();
        #region ILoginService Members

        public Entities.Member getMember(string email, string pass)
        {
            try
            {
                if (email == "" || pass == "")
                {
                    throw new FaultException("Email Hoặc Password Không Được Để Trống");
                }
                else
                {
                    var q = from m in context.Members
                            where m.Email.Equals(email) && m.Password.Equals(pass)
                            select m;
                    return q.SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }

        #endregion
    }
}
